package com.outfood.service.impl;

import org.openqa.selenium.WebDriver;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author huisonglin
 * @Description
 * @PackageName outfoodcat-master
 * @Package com.outfood.service.impl
 * @Date 2024-05-27 11:34
 * @Version 1.0
 */
@Component
public class WebDriverMapService {

    public Map<String, WebDriver> webdrivers = new HashMap<>();


    public void addWebdrivers(String shopId,WebDriver webdriver){
        WebDriver driver = webdrivers.get(shopId);
        if(driver != null){
            try {
                driver.quit();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        webdrivers.put(shopId,webdriver);
    }

    public WebDriver getWebdrivers(String shopId){
        WebDriver driver = webdrivers.get(shopId);
        return driver;
    }
}
